package com.homepage.service.dto;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

@Getter
@Setter
@ToString
public class CompanyWithRelationInfoDTO implements Serializable {
    @Size(max = 30)
    private String id;

    @NotNull
    @Size(max = 150)
    private String streetAddress;

    @Size(max = 10)
    private String postalCode;

    @NotNull
    @Size(max = 16)
    private String city;

    @NotNull
    @Size(max = 16)
    private String stateProvince;

    @NotNull
    private ZonedDateTime expiryDate;

    private Set<EmployeeDTO> employees = new HashSet<>();

    private Set<FeaturetteDTO> featurettes = new HashSet<>();

    private Set<HeadlineDTO> headlines = new HashSet<>();

    private Set<PartnerDTO> partners = new HashSet<>();

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof CompanyDTO)) {
            return false;
        }

        CompanyWithRelationInfoDTO companyDTO = (CompanyWithRelationInfoDTO) o;
        if (this.id == null) {
            return false;
        }
        return Objects.equals(this.id, companyDTO.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(this.id);
    }
}
